```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>矩阵旋转算法可视化 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero-bg {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .code-bg {
            background-color: #2d3748;
        }
        .matrix-cell {
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #e2e8f0;
            font-weight: 500;
        }
        .matrix-row {
            display: flex;
        }
        .transform-step {
            transition: all 0.3s ease;
        }
        .transform-step:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .footer-link:hover {
            color: #a0aec0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-bg text-white py-20">
        <div class="container mx-auto px-6 max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">矩阵旋转算法解密</h1>
                    <p class="text-xl mb-8 opacity-90">探索二维数组顺时针旋转90度的精妙算法</p>
                    <div class="flex space-x-4">
                        <a href="#algorithm" class="bg-white text-purple-700 hover:bg-gray-100 px-6 py-3 rounded-lg font-medium transition duration-300">探索算法</a>
                        <a href="#visualization" class="border-2 border-white text-white hover:bg-white hover:text-purple-700 px-6 py-3 rounded-lg font-medium transition duration-300">查看可视化</a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="flex justify-center">
                        <div class="relative">
                            <!-- Initial Matrix -->
                            <div class="mb-6">
                                <h3 class="text-sm font-medium mb-2 text-purple-200">初始矩阵</h3>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-white text-gray-800">1</div>
                                    <div class="matrix-cell bg-white text-gray-800">2</div>
                                    <div class="matrix-cell bg-white text-gray-800">3</div>
                                    <div class="matrix-cell bg-white text-gray-800">4</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-white text-gray-800">5</div>
                                    <div class="matrix-cell bg-white text-gray-800">6</div>
                                    <div class="matrix-cell bg-white text-gray-800">7</div>
                                    <div class="matrix-cell bg-white text-gray-800">8</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-white text-gray-800">9</div>
                                    <div class="matrix-cell bg-white text-gray-800">10</div>
                                    <div class="matrix-cell bg-white text-gray-800">11</div>
                                    <div class="matrix-cell bg-white text-gray-800">12</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-white text-gray-800">13</div>
                                    <div class="matrix-cell bg-white text-gray-800">14</div>
                                    <div class="matrix-cell bg-white text-gray-800">15</div>
                                    <div class="matrix-cell bg-white text-gray-800">16</div>
                                </div>
                            </div>
                            
                            <!-- Arrow -->
                            <div class="flex justify-center mb-6">
                                <i class="fas fa-arrow-down text-2xl text-yellow-300 animate-bounce"></i>
                            </div>
                            
                            <!-- Rotated Matrix -->
                            <div>
                                <h3 class="text-sm font-medium mb-2 text-purple-200">旋转后矩阵</h3>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">13</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">9</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">5</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">1</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">14</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">10</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">6</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">2</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">15</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">11</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">7</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">3</div>
                                </div>
                                <div class="matrix-row">
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">16</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">12</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">8</div>
                                    <div class="matrix-cell bg-yellow-100 text-gray-800">4</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Algorithm Explanation -->
    <section id="algorithm" class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-6xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">算法思路解析</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">通过两个关键步骤实现矩阵的顺时针90度旋转</p>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <!-- Step 1 -->
                <div class="transform-step bg-gray-50 p-8 rounded-xl shadow-md">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                            <span class="font-bold">1</span>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">转置矩阵</h3>
                    </div>
                    <p class="text-gray-600 mb-4">交换矩阵的行和列，使得矩阵的元素 (i, j) 被移动到 (j, i) 位置</p>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-white text-gray-800">1</div>
                            <div class="matrix-cell bg-white text-gray-800">5</div>
                            <div class="matrix-cell bg-white text-gray-800">9</div>
                            <div class="matrix-cell bg-white text-gray-800">13</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-white text-gray-800">2</div>
                            <div class="matrix-cell bg-white text-gray-800">6</div>
                            <div class="matrix-cell bg-white text-gray-800">10</div>
                            <div class="matrix-cell bg-white text-gray-800">14</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-white text-gray-800">3</div>
                            <div class="matrix-cell bg-white text-gray-800">7</div>
                            <div class="matrix-cell bg-white text-gray-800">11</div>
                            <div class="matrix-cell bg-white text-gray-800">15</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-white text-gray-800">4</div>
                            <div class="matrix-cell bg-white text-gray-800">8</div>
                            <div class="matrix-cell bg-white text-gray-800">12</div>
                            <div class="matrix-cell bg-white text-gray-800">16</div>
                        </div>
                    </div>
                </div>
                
                <!-- Step 2 -->
                <div class="transform-step bg-gray-50 p-8 rounded-xl shadow-md">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-600 text-white w-10 h-10 rounded-full flex items-center justify-center mr-4">
                            <span class="font-bold">2</span>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">水平翻转矩阵</h3>
                    </div>
                    <p class="text-gray-600 mb-4">将转置后的矩阵按水平中线翻转，即交换每一行的元素</p>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-yellow-100 text-gray-800">13</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">9</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">5</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">1</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-yellow-100 text-gray-800">14</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">10</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">6</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">2</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-yellow-100 text-gray-800">15</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">11</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">7</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">3</div>
                        </div>
                    </div>
                    <div class="flex justify-center">
                        <div class="matrix-row">
                            <div class="matrix-cell bg-yellow-100 text-gray-800">16</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">12</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">8</div>
                            <div class="matrix-cell bg-yellow-100 text-gray-800">4</div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-8">
                <div class="flex">
                    <div class="flex-shrink-0 text-blue-500">
                        <i class="fas fa-info-circle text-xl"></i>
                    </div>
                    <div class="ml-3">
                        <p class="text-blue-700"><strong>时间复杂度</strong>: O(n²) - 因为我们需要对矩阵中的每个元素进行操作</p>
                        <p class="text-blue-700"><strong>空间复杂度</strong>: O(1) - 在原地进行旋转，不需要额外的空间</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Code Implementation -->
    <section id="code" class="py-16 bg-gray-50">
        <div class="container mx-auto px-6 max-w-6xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">代码实现</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">Java实现矩阵旋转算法</p>
            </div>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="code-bg px-6 py-4 flex items-center">
                    <div class="flex space-x-2 mr-4">
                        <div class="w-3 h-3 rounded-full bg-red-500"></div>
                        <div class="w-3 h-3 rounded-full bg-yellow-500"></div>
                        <div class="w-3 h-3 rounded-full bg-green-500"></div>
                    </div>
                    <div class="text-gray-300 text-sm">MatrixRotationDemo.java</div>
                </div>
                <div class="p-6 overflow-x-auto">
                    <pre class="text-gray-200 code-bg p-6 rounded-lg"><code class="language-java">
public class MatrixRotationDemo {

    // 打印矩阵
    public static void printMatrix(int[][] matrix) {
        for (int[] row : matrix) {
            for (int value : row) {
                System.out.print(value + " ");
            }
            System.out.println();
        }
    }

    // 顺时针旋转90度
    public static void rotateMatrix90Degrees(int[][] matrix) {
        int n = matrix.length;
        
        // 1. 转置矩阵
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                // 交换元素 (i, j) 和 (j, i)
                int temp = matrix[i][j];
                matrix[i][j] = matrix[j][i];
                matrix[j][i] = temp;
            }
        }

        // 2. 水平翻转矩阵
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n / 2; j++) {
                // 交换第 i 行的第 j 列和第 n-1-j 列
                int temp = matrix[i][j];
                matrix[i][j] = matrix[i][n - 1 - j];
                matrix[i][n - 1 - j] = temp;
            }
        }
    }

    public static void main(String[] args) {
        // 创建一个 4x4 的矩阵
        int[][] matrix = {
            {1, 2, 3, 4},
            {5, 6, 7, 8},
            {9, 10, 11, 12},
            {13, 14, 15, 16}
        };

        // 打印原矩阵
        System.out.println("原矩阵:");
        printMatrix(matrix);

        // 旋转矩阵
        rotateMatrix90Degrees(matrix);

        // 打印旋转后的矩阵
        System.out.println("旋转90度后的矩阵:");
        printMatrix(matrix);
    }
}
                    </code></pre>
                </div>
            </div>
            
            <div class="mt-8 grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-bold text-gray-800 mb-4">输出示例</h3>
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <div class="mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">原矩阵:</h4>
                            <div class="bg-gray-100 p-4 rounded">
                                <div>1 2 3 4</div>
                                <div>5 6 7 8</div>
                                <div>9 10 11 12</div>
                                <div>13 14 15 16</div>
                            </div>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-700 mb-2">旋转90度后的矩阵:</h4>
                            <div class="bg-gray-100 p-4 rounded">
                                <div>13 9 5 1</div>
                                <div>14 10 6 2</div>
                                <div>15 11 7 3</div>
                                <div>16 12 8 4</div>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-bold text-gray-800 mb-4">代码解析</h3>
                    <div class="bg-white p-6 rounded-lg shadow-md">
                        <div class="mb-4">
                            <h4 class="font-medium text-gray-700 mb-2">转置矩阵:</h4>
                            <p class="text-gray-600">外层循环遍历矩阵的每一行，内层循环从当前位置开始交换元素。这一步确保每个元素的位置被交换，即 (i, j) 和 (j, i)。</p>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-700 mb-2">水平翻转矩阵:</h4>
                            <p class="text-gray-600">对矩阵的每一行进行水平翻转，即将行内的元素对调。</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Visualization -->
    <section id="visualization" class="py-16 bg-white">
        <div class="container mx-auto px-6 max-w-6xl">
            <div class="text-center mb-12">
                <h2 class="text-3xl font-bold text-gray-800 mb-4">算法可视化</h2>
                <p class="text-gray-600 max-w-2xl mx-auto">通过交互式图表理解矩阵旋转过程</p>
            </div>
            
            <div class="mb-12">
                <div class="mermaid">
                    graph TD
                    A[开始] --> B[输入N×N矩阵]
                    B --> C[转置矩阵]
                    C --> D[水平翻转矩阵]
                    D --> E[输出旋转后的矩阵]
                    E --> F[结束]
                    
                    subgraph 转置矩阵
                    C --> C1[遍历矩阵]
                    C1 --> C2[交换(i,j)和(j,i)位置的元素]
                    end
                    
                    subgraph 水平翻转
                    D --> D1[遍历每一行]
                    D1 --> D2[交换行首和行尾元素]
                    D2 --> D3[向中间移动]
                    end
                </div>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="transform-step bg-purple-50 p-6 rounded-xl shadow-md border border-purple-100">
                    <div class="text-purple-600 mb-3">
                        <i class="fas fa-project-diagram text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">矩阵转置</h3>
                    <p class="text-gray-600">将矩阵的行列互换，即(i,j)位置的元素移动到(j,i)位置</p>
                </div>
                
                <div class="transform-step bg-blue-50 p-6 rounded-xl shadow-md border border-blue-100">
                    <div class="text-blue-600 mb-3">
                        <i class="fas fa-exchange-alt text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">水平翻转</h3>
                    <p class="text-gray-600">将每一行的元素反转，实现矩阵的水平镜像</p>
                </div>
                
                <div class="transform-step bg-green-50 p-6 rounded-xl shadow-md border border-green-100">
                    <div class="text-green-600 mb-3">
                        <i class="fas fa-check-circle text-2xl"></i>
                    </div>
                    <h3 class="text-xl font-bold text-gray-800 mb-2">结果验证</h3>
                    <p class="text-gray-600">最终得到顺时针旋转90度后的矩阵</p>
                </div>
            </div>
        </div>
    </section>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12">
        <div class="container mx-auto px-6 max-w-6xl">
            <div class="text-center">
                <h3 class="text-xl font-bold mb-2">技术小馆</h3>
                <p class="text-gray-400 mb-4">探索编程世界的精彩</p>
                <div class="flex justify-center space-x-4">
                    <a href="http://www.yuque.com/jtostring" class="footer-link text-gray-300 hover:text-white transition duration-300">
                        <i class="fas fa-globe mr-1"></i> 语雀主页
                    </a>
                </div>
                <div class="mt-6 text-gray-500 text-sm">
                    &copy; 2023 技术小馆. 保留所有权利.
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```